var FlowSelector = {
	getView : function(h, f) {
		var g = null;
		if (f) {
			var g = new Ext.grid.CheckboxSelectionModel({
				singleSelect : true
			});
		} else {
			g = new Ext.grid.CheckboxSelectionModel();
		}
		var b = new Ext.grid.ColumnModel({
			columns : [ g, new Ext.grid.RowNumberer(), {
				header : "defId",
				dataIndex : "defId",
				hidden : true
			}, {
				header : "流程的名称",
				dataIndex : "name"
			}, {
				header : "描述",
				dataIndex : "description"
			} ]
		});
		var c = new Ext.data.Store({
			proxy : new Ext.data.HttpProxy({
				url : __ctxPath + "/flow/listProDefinition.do",
				params : {
					typeId : this.typeId == null ? 0 : this.typeId
				}
			}),
			reader : new Ext.data.JsonReader({
				root : "result",
				totalProperty : "totalCounts",
				id : "id",
				fields : [ {
					name : "defId",
					type : "int"
				}, "proType", "name", "description", "createtime", "deployId",
						"processName" ]
			}),
			remoteSort : true
		});
		c.setDefaultSort("defId", "desc");
		var d = new Ext.grid.GridPanel({
			id : "FlowSelectorGrid",
			width : 400,
			height : 300,
			region : "center",
			title : "流程列表",
			store : c,
			shim : true,
			trackMouseOver : true,
			disableSelection : false,
			loadMask : true,
			cm : b,
			sm : g,
			viewConfig : {
				forceFit : true,
				enableRowBody : false,
				showPreview : false
			},
			bbar : new HT.PagingBar({
				store : c
			})
		});
		c.load({
			params : {
				start : 0,
				limit : 10
			}
		});
		var a = new Ext.FormPanel(
				{
					width : 400,
					region : "north",
					id : "FlowSearchForm",
					height : 40,
					frame : false,
					border : false,
					layout : "hbox",
					layoutConfig : {
						padding : "5",
						align : "middle"
					},
					defaults : {
						xtype : "label",
						margins : {
							top : 0,
							right : 4,
							bottom : 4,
							left : 4
						}
					},
					items : [
							{
								text : "请输入查询条件:"
							},
							{
								text : "流程的名称"
							},
							{
								xtype : "textfield",
								name : "Q_name_S_LK"
							},
							{
								xtype : "button",
								text : "查询",
								iconCls : "search",
								handler : function() {
									if (a.getForm().isValid()) {
										a
												.getForm()
												.submit(
														{
															waitMsg : "正在提交查询",
															url : __ctxPath
																	+ "/flow/listProDefinition.do",
															success : function(
																	j, k) {
																var i = Ext.util.JSON
																		.decode(k.response.responseText);
																d
																		.getStore()
																		.loadData(
																				i);
															}
														});
									}
								}
							} ]
				});
		var e = new Ext.Window({
			title : "流程选择",
			iconCls : "menu-flow",
			width : 630,
			height : 380,
			layout : "border",
			border : false,
			items : [ a, d ],
			modal : true,
			buttonAlign : "center",
			buttons : [ {
				iconCls : "btn-ok",
				text : "确定",
				handler : function() {
					var k = Ext.getCmp("FlowSelectorGrid");
					var m = k.getSelectionModel().getSelections();
					var n = "";
					var o = "";
					var l = "";
					for (var j = 0; j < m.length; j++) {
						if (j > 0) {
							n += ",";
							o += ",";
							l += ",";
						}
						n += m[j].data.defId;
						o += m[j].data.name;
						l += m[j].data.processName;
					}
					if (h != null) {
						h.call(this, n, o, l);
					}
					e.close();
				}
			}, {
				text : "取消",
				iconCls : "btn-cancel",
				handler : function() {
					e.close();
				}
			} ]
		});
		return e;
	}
};